package de.baumann.browser.views.dialog

import android.content.Context
import android.view.Gravity
import android.widget.Toast
import de.baumann.browser.R
import kotlinx.android.synthetic.main.dialog_comment.*

/**
 *@author:
 *@date:2019/7/25 10:21
 *@discription: 评论Dialog
 */
open class CommentDialog(context: Context, var commentListenber: OnCommentListenber) : BaseDialog(context, R.style.inputDialog) {

    override fun laoutId(): Int {
        return R.layout.dialog_comment
    }

    override fun initView() {
        tvPublish.setOnClickListener {
            val content = edComment.text.toString().trim()
            if (content.isEmpty()) {
                Toast.makeText(context, context.getString(R.string.input_content), Toast.LENGTH_SHORT).show()
                return@setOnClickListener
            }
            commentListenber.comment(content)
        }
    }

    override fun gravity(): Int {
        return Gravity.BOTTOM
    }

    interface OnCommentListenber {
        fun comment(content: String)
    }

}